public class NocSim {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		TopologyReader tr = new TopologyReader();
		tr.readFile("5n.txt");
		System.out.println("Done Loading data");

		for (int i = 0; i < DataStore.getInstance().getNumberOfNodes(); i++) {
			if (DataStore.getInstance().getNode(i) != null) {
				// DataStore.getInstance().getNode(i).allocateBuffers();
			}
		}

		// DataStore.getInstance().printNodes();
		// DataStore.getInstance().nodes[2].printRoutes();
		do {

			for (int i = 0; i < DataStore.getInstance().getNumberOfNodes(); i++) {
				Node n=DataStore.getInstance().getNode(i);
				if (n != null) {
					if (new MersenneTwister().nextInt() % 10 == 0) {
						n.generatePackage();
					}
					n.internalRoute();
				}
			}

			Timer.getInstance().tick();
		} while (Timer.getInstance().getTime() < 100);

		// test pentru clasa Buffer
		/*
		 * Buffer b = new Buffer(5);
		 * 
		 * PackageGenerator pg = MTGenerator.getInstance(); try {
		 * b.add(pg.getPackage()); b.add(pg.getPackage()); b.get();
		 * b.add(pg.getPackage()); b.add(pg.getPackage());
		 * b.add(pg.getPackage()); b.get(); b.add(pg.getPackage()); b.get(); }
		 * catch (Exception e) { e.printStackTrace(); }
		 * 
		 * System.out.println(b);
		 */
		System.out.println("All done");
	}

}
